package com.example.idea.mapper;

import com.example.idea.entity.Logs;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LogsMapper {
    @Insert("insert into logs(operation,type,ip,user,time) values(#{operation},#{type},#{ip},#{user},#{time})")
    void add(Logs logs);

    void update(Logs logs);

    void delete(Integer id);

    Logs query(Integer id);

    @Delete("delete from logs where id in (${idsStr})")
    void deleteBatch(String idsStr);

    @Select("select * from logs")
    List<Logs> list();

    List<Logs> selectList(Logs logs);

    List<Logs> selectByPage(Integer skipNum, Integer pageSize, String operation, String type);

    @Select("select count(*) from logs where operation like '%${operation}%' and type like '%${type}%'")
    Integer selectCountByPage(String operation, String type);
}
